{extend name="public:layout" /}
{block name="title"}站点配置{/block}
{block name="head"}
{:widget('common/Form/icheckRes')}{:widget('common/Form/validRes')}
{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> <a href="{:url('index')}"> 站点配置</a></li>
                <li class="active">添加配置</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form">
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">配置标题</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" placeholder="请输入配置标题"
                               name="title" value="" datatype="*"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">配置组</label>
                    <div class="col-sm-4">
                        <select name="group_id" class="form-control">
                            {volist name="group" id="vo"}
                            <option value="{$vo.id}">{$vo.group_title}</option>
                            {/volist}
                        </select>
                    </div>
                    <label class="col-sm-2 control-label Validform_label">配置标识</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="请输入配置标识"
                               name="name" value="" datatype="*"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">配置值</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="请输入配置值"
                               name="value" value="" />
                    </div>
                    <label class="col-sm-2 control-label Validform_label">提示信息</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="请输入提示信息"
                               name="message" value="" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">显示方法</label>
                    <div class="col-sm-10">
                        <label class="radio-inline i-checks">
                            <input type="radio" checked name="show_type" value="text"> 文本框
                        </label>
                        <label class="radio-inline i-checks">
                            <input type="radio" name="show_type" value="radio"> 单选框
                        </label>
                        <label class="radio-inline i-checks">
                            <input type="radio" name="show_type" value="select"> 选择框
                        </label>
                        <label class="radio-inline i-checks">
                            <input type="radio" name="show_type" value="textarea"> 多行文本
                        </label>
                        <label class="radio-inline i-checks">
                            <input type="radio" name="show_type" value="upimg"> 图片上传框
                        </label>
                    </div>
                </div>
                <div class="form-group remark" style="display:none;">
                    <label class="col-sm-2 control-label Validform_label">选项参数</label>
                    <div class="col-sm-10">
                        <textarea name="info" class="form-control" placeholder="请填写选项参数" rows="3"></textarea>
                        <span class="help-block">如：1|开启,0|关闭.（对单选框和选择框有效)</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">系统配置</label>
                    <div class="col-sm-4">
                        <label class="radio-inline i-checks">
                            <input type="radio" name="system" value="1"> 是
                        </label>
                        <label class="radio-inline i-checks">
                            <input type="radio" checked name="system" value="0"> 否
                        </label>
                        <span class="help-block">是否系统配置，选是后将锁定配置无法删除。</span>
                    </div>
                    <label class="col-sm-2 control-label Validform_label">排序</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control"
                               name="config_sort" value="0" datatype="n"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary" onclick="ajaxSubForm();" type="submit">保存内容</button>
                        <a href="{:url('index')}" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        iCheck();
        $("input[name='show_type']").on('ifChecked', function(event){
            var showType = $('input[name="show_type"]:checked ').val();
            if(showType=='select' || showType=='radio'){
                $('.remark').show();
            }else{
                $('.remark').hide();
            }
        });
    })
</script>
{/block}